﻿namespace Iterator;

public class Sample
{
    public List<double> Prices { get; set; } = new List<double>() { 98, 33, 129 };

    public IEnumerable<int> Method()
    {
        Console.WriteLine("Iterator method executes");
        yield return 11;
        Console.WriteLine("Iterator method executes continued");
        yield return 11222;
    }

    public IEnumerable<double> Method2()
    {
        double sum = 0;
        foreach (var item in Prices)
        {
            sum += item;
            yield return sum;
        }
    }
}